From c7d899c535afce21e0d2ffea94520a2625e4da80 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Tue, 17 Jan 2017 02:20:08 +0100 Subject: [PATCH] vulkan: Move push constants into their own header This is the first step towards easing maintenance of the Vulkan shaders by moving common code into headers. --- gsk/Makefile.am | 1 + .../vulkan/blend-clip-rounded.vert.glsl | 9 ++------- .../vulkan/blend-clip-rounded.vert.spv | Bin 4940 -> 4940 bytes gsk/resources/vulkan/blend-clip.vert.glsl | 9 ++------- gsk/resources/vulkan/blend-clip.vert.spv | Bin 4604 -> 4604 bytes gsk/resources/vulkan/blend.vert.glsl | 9 ++------- gsk/resources/vulkan/blend.vert.spv | Bin 1964 -> 1964 bytes .../vulkan/border-clip-rounded.vert.glsl | 9 ++------- .../vulkan/border-clip-rounded.vert.spv | Bin 9312 -> 9312 bytes gsk/resources/vulkan/border-clip.vert.glsl | 9 ++------- gsk/resources/vulkan/border-clip.vert.spv | Bin 8952 -> 8952 bytes gsk/resources/vulkan/border.vert.glsl | 9 ++------- gsk/resources/vulkan/border.vert.spv | Bin 7216 -> 7216 bytes .../vulkan/color-clip-rounded.vert.glsl | 9 ++------- .../vulkan/color-clip-rounded.vert.spv | Bin 2176 -> 2176 bytes gsk/resources/vulkan/color-clip.vert.glsl | 9 ++------- gsk/resources/vulkan/color-clip.vert.spv | Bin 3588 -> 3588 bytes .../color-matrix-clip-rounded.vert.glsl | 9 ++------- .../vulkan/color-matrix-clip-rounded.vert.spv | Bin 5292 -> 5292 bytes .../vulkan/color-matrix-clip.vert.glsl | 9 ++------- .../vulkan/color-matrix-clip.vert.spv | Bin 4956 -> 4956 bytes gsk/resources/vulkan/color-matrix.vert.glsl | 9 ++------- gsk/resources/vulkan/color-matrix.vert.spv | Bin 2316 -> 2316 bytes gsk/resources/vulkan/color.vert.glsl | 9 ++------- gsk/resources/vulkan/color.vert.spv | Bin 1780 -> 1780 bytes gsk/resources/vulkan/constants.glsl | 11 +++++++++++ .../vulkan/linear-clip-rounded.vert.glsl | 9 ++------- .../vulkan/linear-clip-rounded.vert.spv | Bin 6208 -> 6208 bytes gsk/resources/vulkan/linear-clip.vert.glsl | 9 ++------- gsk/resources/vulkan/linear-clip.vert.spv | Bin 5856 -> 5856 bytes gsk/resources/vulkan/linear.vert.glsl | 9 ++------- gsk/resources/vulkan/linear.vert.spv | Bin 7648 -> 7648 bytes 32 files changed, 42 insertions(+), 105 deletions(-) create mode 100644 gsk/resources/vulkan/constants.glsl diff --git a/gsk/Makefile.am b/gsk/Makefile.am index d665e1d1a2..38148452de 100644 --- a/gsk/Makefile.am +++ b/gsk/Makefile.am @@ -58,6 +58,7 @@ gsk_private_vulkan_source_c = \ gskvulkanrenderpass.c \ gskvulkanshader.c gsk_private_vulkan_include_shaders = \ + resources/vulkan/constants.glsl \ resources/vulkan/rounded-rect.glsl gsk_private_vulkan_shaders = \ resources/vulkan/blend-clip.frag.glsl \ diff --git a/gsk/resources/vulkan/blend-clip-rounded.vert.glsl b/gsk/resources/vulkan/blend-clip-rounded.vert.glsl index c680c65455..221cbbeeba 100644 --- a/gsk/resources/vulkan/blend-clip-rounded.vert.glsl +++ b/gsk/resources/vulkan/blend-clip-rounded.vert.glsl @@ -1,15 +1,10 @@ #version 420 core +#include "constants.glsl" + layout(location = 0) in vec4 inRect; layout(location = 1) in vec4 inTexRect; -layout(push_constant) uniform PushConstants { - mat4 mvp; - vec4 clip_bounds; - vec4 clip_widths; - vec4 clip_heights; -} push; - layout(location = 0) out vec2 outPos; layout(location = 1) out vec2 outTexCoord; layout(location = 2) out flat vec4 outClipBounds; diff --git a/gsk/resources/vulkan/blend-clip-rounded.vert.spv b/gsk/resources/vulkan/blend-clip-rounded.vert.spv index 0c27a6b096ec10d331a5197fb9c265f3f9c57b62..2a2d7ce9a408a3ef072cec494aafb9faed33150d 100644 GIT binary patch delta 20 acmX@3c1DexnMs+Qfq@YSc{g%93IhNtlLI~g delta 20 acmX@3c1DexnMs+Qfq@YSIW}@T3IhNtdILEC diff --git a/gsk/resources/vulkan/blend-clip.vert.glsl b/gsk/resources/vulkan/blend-clip.vert.glsl index 0d66a2dcd7..b1c622bea2 100644 --- a/gsk/resources/vulkan/blend-clip.vert.glsl +++ b/gsk/resources/vulkan/blend-clip.vert.glsl @@ -1,15 +1,10 @@ #version 420 core +#include "constants.glsl" + layout(location = 0) in vec4 inRect; layout(location = 1) in vec4 inTexRect; -layout(push_constant) uniform PushConstants { - mat4 mvp; - vec4 clip_bounds; - vec4 clip_widths; - vec4 clip_heights; -} push; - layout(location = 0) out vec2 outTexCoord; out gl_PerVertex { diff --git a/gsk/resources/vulkan/blend-clip.vert.spv b/gsk/resources/vulkan/blend-clip.vert.spv index a12f3c8d9e43d47964644d52069e69f0d1b75ed0..494f9165373308adaa2da2b368609d0bfd8aa489 100644 GIT binary patch delta 20 acmeyP{70FanMs+Qfq@YSc{g%@6a)Y=r36L* delta 20 acmeyP{70FanMs+Qfq@YSIW}^C6a)Y=j08ad diff --git a/gsk/resources/vulkan/blend.vert.glsl b/gsk/resources/vulkan/blend.vert.glsl index 30c1474f9c..17be873457 100644 --- a/gsk/resources/vulkan/blend.vert.glsl +++ b/gsk/resources/vulkan/blend.vert.glsl @@ -1,15 +1,10 @@ #version 420 core +#include "constants.glsl" + layout(location = 0) in vec4 inRect; layout(location = 1) in vec4 inTexRect; -layout(push_constant) uniform PushConstants { - mat4 mvp; - vec4 clip_bounds; - vec4 clip_widths; - vec4 clip_heights; -} push; - layout(location = 0) out vec2 outTexCoord; out gl_PerVertex { diff --git a/gsk/resources/vulkan/blend.vert.spv b/gsk/resources/vulkan/blend.vert.spv index dafd915f8c7eb6da168b3c6c2fe155e9717da7d4..962a1b4e18904869424484829444034b01068556 100644 GIT binary patch delta 20 acmZ3(zlNWinMs+Qfq@YSc{g$|WCs8vO9LbT delta 20 acmZ3(zlNWinMs+Qfq@YSIW}@HWCs8vG6Np~ diff --git a/gsk/resources/vulkan/border-clip-rounded.vert.glsl b/gsk/resources/vulkan/border-clip-rounded.vert.glsl index 8939a95d9b..a66d7f78dc 100644 --- a/gsk/resources/vulkan/border-clip-rounded.vert.glsl +++ b/gsk/resources/vulkan/border-clip-rounded.vert.glsl @@ -1,18 +1,13 @@ #version 420 core +#include "constants.glsl" + layout(location = 0) in vec4 inRect; layout(location = 1) in vec4 inCornerWidths; layout(location = 2) in vec4 inCornerHeights; layout(location = 3) in vec4 inBorderWidths; layout(location = 4) in mat4 inBorderColors; -layout(push_constant) uniform PushConstants { - mat4 mvp; - vec4 clip_bounds; - vec4 clip_widths; - vec4 clip_heights; -} push; - layout(location = 0) out vec2 outPos; layout(location = 1) out flat vec4 outColor; layout(location = 2) out flat vec4 outRect; diff --git a/gsk/resources/vulkan/border-clip-rounded.vert.spv b/gsk/resources/vulkan/border-clip-rounded.vert.spv index 5aae91ae719b6bcfd05d4d145cb34478141f2360..527168616730a55869060d53506ee6fa6095d492 100644 GIT binary patch delta 20 acmaFh@xX(dnMs+Qfq@YSc{g&0ssI2oj04XA delta 20 acmaFh@xX(dnMs+Qfq@YSIW}^KssI2oa|6l% diff --git a/gsk/resources/vulkan/border-clip.vert.glsl b/gsk/resources/vulkan/border-clip.vert.glsl index 5de7a12f70..8db91a58a4 100644 --- a/gsk/resources/vulkan/border-clip.vert.glsl +++ b/gsk/resources/vulkan/border-clip.vert.glsl @@ -1,18 +1,13 @@ #version 420 core +#include "constants.glsl" + layout(location = 0) in vec4 inRect; layout(location = 1) in vec4 inCornerWidths; layout(location = 2) in vec4 inCornerHeights; layout(location = 3) in vec4 inBorderWidths; layout(location = 4) in mat4 inBorderColors; -layout(push_constant) uniform PushConstants { - mat4 mvp; - vec4 clip_bounds; - vec4 clip_widths; - vec4 clip_heights; -} push; - layout(location = 0) out vec2 outPos; layout(location = 1) out flat vec4 outColor; layout(location = 2) out flat vec4 outRect; diff --git a/gsk/resources/vulkan/border-clip.vert.spv b/gsk/resources/vulkan/border-clip.vert.spv index 5a505d8ebc4bb7d63c66d72da4dad16ab2004b97..ce5e85e3dce516d82e033bb5e2dd1f906e25c462 100644 GIT binary patch delta 20 acmez2`ooo*nMs+Qfq@YSc{g&uRRRDu-UN>T delta 20 acmez2`ooo*nMs+Qfq@YSIW}^?RRRDu#RQ4~ diff --git a/gsk/resources/vulkan/border.vert.glsl b/gsk/resources/vulkan/border.vert.glsl index 48efbc7e40..744f5000ef 100644 --- a/gsk/resources/vulkan/border.vert.glsl +++ b/gsk/resources/vulkan/border.vert.glsl @@ -1,18 +1,13 @@ #version 420 core +#include "constants.glsl" + layout(location = 0) in vec4 inRect; layout(location = 1) in vec4 inCornerWidths; layout(location = 2) in vec4 inCornerHeights; layout(location = 3) in vec4 inBorderWidths; layout(location = 4) in mat4 inBorderColors; -layout(push_constant) uniform PushConstants { - mat4 mvp; - vec4 clip_bounds; - vec4 clip_widths; - vec4 clip_heights; -} push; - layout(location = 0) out vec2 outPos; layout(location = 1) out flat vec4 outColor; layout(location = 2) out flat vec4 outRect; diff --git a/gsk/resources/vulkan/border.vert.spv b/gsk/resources/vulkan/border.vert.spv index 384eebeae85d3da07f94bec695a59534439e6b11..6a6cf93865891ea37a906dd086e750db87a14dc2 100644 GIT binary patch delta 20 acmdmBvB83ynMs+Qfq@YSc{g&a$^ZZ;!~+)q delta 20 acmdmBvB83ynMs+Qfq@YSIW}^u$^ZZ;s{;}M diff --git a/gsk/resources/vulkan/color-clip-rounded.vert.glsl b/gsk/resources/vulkan/color-clip-rounded.vert.glsl index a3c55351a2..2303d90e70 100644 --- a/gsk/resources/vulkan/color-clip-rounded.vert.glsl +++ b/gsk/resources/vulkan/color-clip-rounded.vert.glsl @@ -1,15 +1,10 @@ #version 420 core +#include "constants.glsl" + layout(location = 0) in vec4 inRect; layout(location = 1) in vec4 inColor; -layout(push_constant) uniform PushConstants { - mat4 mvp; - vec4 clip_bounds; - vec4 clip_widths; - vec4 clip_heights; -} push; - layout(location = 0) out vec2 outPos; layout(location = 1) out flat vec4 outColor; layout(location = 2) out flat vec4 outClipBounds; diff --git a/gsk/resources/vulkan/color-clip-rounded.vert.spv b/gsk/resources/vulkan/color-clip-rounded.vert.spv index 4414e997dd1c3d516703518f757925920dc3a39b..b28355446742af9ee4540fa8e646452aea568189 100644 GIT binary patch delta 20 ZcmZn=Y!KvTW>RKnU|RKnU|RKnU|y2g155w_ delta 20 ZcmZpXX_4V(W>RKnU|y2H14jS= diff --git a/gsk/resources/vulkan/color-matrix-clip-rounded.vert.glsl b/gsk/resources/vulkan/color-matrix-clip-rounded.vert.glsl index 2875e637f7..5d3e3400e6 100644 --- a/gsk/resources/vulkan/color-matrix-clip-rounded.vert.glsl +++ b/gsk/resources/vulkan/color-matrix-clip-rounded.vert.glsl @@ -1,17 +1,12 @@ #version 420 core +#include "constants.glsl" + layout(location = 0) in vec4 inRect; layout(location = 1) in vec4 inTexRect; layout(location = 2) in mat4 inColorMatrix; layout(location = 6) in vec4 inColorOffset; -layout(push_constant) uniform PushConstants { - mat4 mvp; - vec4 clip_bounds; - vec4 clip_widths; - vec4 clip_heights; -} push; - layout(location = 0) out vec2 outPos; layout(location = 1) out vec2 outTexCoord; layout(location = 2) out flat vec4 outClipBounds; diff --git a/gsk/resources/vulkan/color-matrix-clip-rounded.vert.spv b/gsk/resources/vulkan/color-matrix-clip-rounded.vert.spv index 49271e4572b220e08d7ca1ea87923429cc778fb9..d4db4839d1827fba2b328280bbf9fe0c7eae7a17 100644 GIT binary patch delta 20 acmZ3Zxki(lnMs+Qfq@YSc{g$|6afGy00U(J delta 20 acmZ3Zxki(lnMs+Qfq@YSIW}@H6afGx=L28> diff --git a/gsk/resources/vulkan/color-matrix-clip.vert.glsl b/gsk/resources/vulkan/color-matrix-clip.vert.glsl index 94d4ef8f90..7f9b77840a 100644 --- a/gsk/resources/vulkan/color-matrix-clip.vert.glsl +++ b/gsk/resources/vulkan/color-matrix-clip.vert.glsl @@ -1,17 +1,12 @@ #version 420 core +#include "constants.glsl" + layout(location = 0) in vec4 inRect; layout(location = 1) in vec4 inTexRect; layout(location = 2) in mat4 inColorMatrix; layout(location = 6) in vec4 inColorOffset; -layout(push_constant) uniform PushConstants { - mat4 mvp; - vec4 clip_bounds; - vec4 clip_widths; - vec4 clip_heights; -} push; - layout(location = 0) out vec2 outTexCoord; layout(location = 1) out flat mat4 outColorMatrix; layout(location = 5) out flat vec4 outColorOffset; diff --git a/gsk/resources/vulkan/color-matrix-clip.vert.spv b/gsk/resources/vulkan/color-matrix-clip.vert.spv index 6648e245ba0bcfabd4d69739fb13b23353b78d55..84c384622efbb137f4efc0fcb0929b6fe2e9799d 100644 GIT binary patch delta 20 acmcbkc1MkynMs+Qfq@YSc{g$g3IhNw69aAl delta 20 acmcbkc1MkynMs+Qfq@YSIW}?!3IhNv`U7bI diff --git a/gsk/resources/vulkan/color-matrix.vert.glsl b/gsk/resources/vulkan/color-matrix.vert.glsl index 20b3bbd8d0..ac1ccc0a54 100644 --- a/gsk/resources/vulkan/color-matrix.vert.glsl +++ b/gsk/resources/vulkan/color-matrix.vert.glsl @@ -1,17 +1,12 @@ #version 420 core +#include "constants.glsl" + layout(location = 0) in vec4 inRect; layout(location = 1) in vec4 inTexRect; layout(location = 2) in mat4 inColorMatrix; layout(location = 6) in vec4 inColorOffset; -layout(push_constant) uniform PushConstants { - mat4 mvp; - vec4 clip_bounds; - vec4 clip_widths; - vec4 clip_heights; -} push; - layout(location = 0) out vec2 outTexCoord; layout(location = 1) out flat mat4 outColorMatrix; layout(location = 5) out flat vec4 outColorOffset; diff --git a/gsk/resources/vulkan/color-matrix.vert.spv b/gsk/resources/vulkan/color-matrix.vert.spv index 2985b7409d2243baadada0bce904d3d12d952ec8..fa89276b21107d266635f7c9d3aa42a87c3ba3f0 100644 GIT binary patch delta 20 ZcmeAX>Jj2*W>RKnU|Jj2*W>RKnU|>vv delta 20 acmaE0{lJ==nMs+Qfq@YSIW}@%l?4DXm;@;R -- 2.30.2